/*
Content: Master file for replication of PASS results (Table G.9)
Paper: "Immigrants Return Intentions and Labor Market Behavior when the Home Country is Unsafe"
Journal: Journal of Labor Economics
Authors: Jacopo Bassetto, Teresa Freitas-Monteiro
*/


clear
clear mata
clear matrix

set more off, perm					// do not allow breaks in output
set maxvar 100000, perm


********************************************************************************
*** GLOBALS 
********************************************************************************

clear
clear mata 
clear matrix
set matsize 2000
capture log close 
set more off       // Assures the program not to 'BREAK'
set maxvar 8000

global path ""
global data "$path/Daten"

global datapass "$data/passdata"

global dataextra "$data/extradatasets"
global dataevent "$data/eventsdata"
	global uppsala "$dataevent/uppsala"
	global globalterror "$dataevent/globalterror"
global codes "$data/country_codes"


global prog "$path/prog/replication_jole/PASS" 
global table "$path/tabs/replication_jole/PASS" 
global graph "$path/figs/replication_jole/PASS" 
global log "$path/log"


capture log close
cd "$path"

********************************************************************************
*** ADOS
********************************************************************************

adopath ++ "N:\Ablagen\D01700-BQE\ado\"
adopath ++ "N:\Ablagen\D01700-BQE\ado"


sysdir set SITE "N:\Ablagen\D01700-Allgemein\STATA\bocode/"	



********************************************************************************
**# DATA REQUIREMENT
********************************************************************************

	/*
	
	Original Datasets: 
	
	- GLOBAL TERROR DATABASE: for this analysis we used the version from 1970-2020, downloaded July 28, 2024
	- PASS dataset: version "PASS_0621_v2" as provided by the Research Center (FDZ) at the Institute for Employment Research (IEB)
	
	*******
	
	Support Datasets: 
	
	- Correspondence table between country codes in event datasets and GSOEP country identifiers: 
		-> countrycodes_pass_terror.dta
	
	*/



********************************************************************************
**# DATA PREPARATION
********************************************************************************
do "$prog/1_1_PASS_event_prep_final.do"
do "$prog/1_2_PASS_create_monthly_events_final.do"
do "$prog/2_PASS_events_final.do"

********************************************************************************
**# ANALYSIS
********************************************************************************

do "$prog/3_PASS_mainregressions_final.do"

